<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\file\FileInput;
use kartik\select2\Select2;
use yii\web\JsExpression;
use app\common\Functions;
use yii\widgets\LinkPager;
use yii\grid\GridView;
use yii\bootstrap\Modal;
use kartik\date\DatePicker;
use kartik\datetime\DateTimePicker;
use app\models\AttrSpec;

/* @var $this yii\web\View */
/* @var $model \yii2mod\rbac\models\BizRuleModel */
/* @var $form ActiveForm */
?>

<?php
    $fieldOptions  = [];
    $labelOptions  = [];
    $fieldOptions['class']  = 'col-md-6';
    $options['options']=$fieldOptions;
    $selectOptions = [];
    $selectOptions['style'] = 'width:100%';
    $selectOptions['class'] = ' select2 select2-hidden-accessible';

    // 区分是创建还是更新
    if ($update)
    {
        $commitbtnText = '更新';
    }


?>




<?php

//
    $form = ActiveForm::begin();

    // 隐藏的就直接输出，不参与排序
    echo  $form->field($model, 'id',['labelOptions'=>['style'=>'display:none']])->hiddenInput(['value' => $model->id]);
    echo  $form->field($orderModel, 'id',['labelOptions'=>['style'=>'display:none']])->hiddenInput(['value' => $orderModel->id]);

    // 构建展示膜版的数组
    $showForm = [];
    $showForm['cust_name']['form']       = $form->field($model, 'cust_name')->label( $prodSpecName . '客户名称')->textInput(['maxlength' => 64   ]);


    $showForm['parent_cust_source_id']['form'] = $form->field($model, 'parentCustSourceID' )->label('客户归属品牌')->dropDownList( $custSources, [
    'prompt'=>'--请选择客户类型--',

            'onchange'=>'
                        $(".form-group #cust-cust_source_id").show();
                        $.post("'.yii::$app->urlManager->createUrl('/prod/cust/custsource').'?parent_cust_source_id="+$(this).val(),function(data){
                        $("select#cust-cust_source_id").html(data);
                        });',
        ]);

    $showForm['cust_source_id']['form'] = $form->field($model, 'cust_source_id' )->label('客户来源')->dropDownList( $model->getSubCustSources($model->parentCustSourceID));


    $showForm['cust_type_id']['form']   = $form->field($model, 'cust_type_id'  )->label('客户类型')->dropDownList( $domainTypes );


//    $showForm['order_region_id']['form']   = $form->field($orderModel, "region_id")->label('板块') ->dropDownList( $model->getCityList(16), [
//    'prompt'=>'--请选择区域--']);





    $showForm['input_time']['form']= $form->field($orderModel, 'input_time')->label( '录入咨询日期')->widget(DateTimePicker::classname(), [
        'options' => ['placeholder' => ''],
        'pluginOptions' => [
            'autoclose' => true,
            'todayHighlight' => true,
            'format' => 'yyyy-mm-dd hh:ii:ss',
        ]
    ]);

    $showForm['order_remark']['form']   = $form->field($orderModel, 'remark')->label(  '客户备注')->textarea(['rows'=>10,'maxlength' => 512,'placeholder'=>'请填写备注']);
//     if (!$update){
         $orderStaffIDStyles = [];

        if ($update && $orderModel->staffName)
        {
            $orderStaffIDStyles['initValueText']  = $orderModel->staffName;
        }
         $orderStaffIDStyles['options'] = ['placeholder' => '请选择 ...'];
         $orderStaffIDStyles['pluginOptions'] = [
             'placeholder' => '查询 ...',
             'allowClear' => true,
             'minimumInputLength' => 1,
             'language' => [
                 'errorLoading' => new JsExpression("function () { return '稍等...'; }"),
             ],
             'ajax' => [
                 'url' => '/prod/prodinst/seachorderstaff',
                 'dataType' => 'json',
                 'data' => new JsExpression('function(params) { return {q:params.term}; }')
             ],
             'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
             'templateResult' => new JsExpression('function(res) { 
                    return res.text; }'),
             'templateSelection' => new JsExpression('function (res) { 
                            return res.text; }')];
         $showForm['orderStaffID']['form']   =  $form->field($orderModel, 'staff_id')->label( '分配追踪人')->widget(Select2::classname(), $orderStaffIDStyles);
      //   $showForm['orderRemark']['form']     = $form->field($model, 'orderRemark')->label( '订单描述')->textarea(['rows'=>3,'maxlength' => 64]);


         // 查找出订单的特性
         foreach ($orderAttrSpecs as $attrSpec)
         {
             $orderAttr = $attrSpec->attrSpecs;
             // 文件
             if ($orderAttr->attr_spec_type_id==2)
             {
                 $pluginOptions=[];
                 $pluginOptions['initialPreviewAsData'] = true;
                 $pluginOptions['showRemove'] = true;
                 $pluginOptions['showUpload'] = false;

                 if ($update)
                 {
                     $pluginOptions['initialPreview'] = $p1[$orderAttr->attr_spec_id];
                 }

                 $showForm['order_' . $orderAttr->attr_field_name]['form']       =  $form->field($uploadModel, "file[{$orderAttr->attr_spec_id}][]")->label($orderAttr->attr_spec_name)->widget(FileInput::classname(), [
                     'options' => ['multiple' => false],
                     'pluginOptions' =>$pluginOptions,
                 ])->fileInput();
             }
             elseif ($orderAttr->attr_spec_type_id==3) // 如果type等于3 需要进行字符转义
             {
                 if($orderAttr->attr_spec_id==25){//客户创建需求是添加一个全部的装修
                     $renovation_flag=Functions::getDomains('attr_spec',$orderAttr->attr_spec_id);
                     $renovation_flag[''] = '全部';
                     ksort($renovation_flag);
                     $showForm['order_' . $orderAttr->attr_field_name]['form']       =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]")->label($orderAttr->attr_spec_name)->dropDownList($renovation_flag);
                 }else{
                     $showForm['order_' . $orderAttr->attr_field_name]['form']       =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]")->label($orderAttr->attr_spec_name)->dropDownList(Functions::getDomains('attr_spec',$orderAttr->attr_spec_id));
                 }

             }
             elseif ($orderAttr->attr_spec_type_id==4) // 如果type等于4 说明是一组值
             {
                 $showForm['order_' . $orderAttr->attr_field_name]['form']               =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]"
//                     ,
//                     [
//                         'template' => " {label}\n<div class=\"input-group\">{input}<span class=\"input-group-addon\">--</span></div>\n{error}"]

                     )->label( '最小' .  $orderAttr->attr_spec_name)->textInput(['maxlength' => 64]);
                 $showForm['order_' . $orderAttr->attr_field_name . '_2']['form']       =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content2]")->label('最大' . $orderAttr->attr_spec_name)->textInput(['maxlength' => 64]);
             }
             elseif ($orderAttr->attr_spec_type_id==1) // 如果type等于1说明是区域
             {
//                 $showForm['order_region_id']['form']       =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]")->label(  $orderAttr->attr_spec_name)->dropDownList( $model->getCityList(16), [
//                     'prompt'=>'--请选择区域--']);

                 $showForm['order_region_id']['form']   = $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]")->label( $orderAttr->attr_spec_name)->widget(Select2::classname(), [
                 'data' => $model->getCityList(16),
                 'options' => ['multiple' => true, 'placeholder' => '请选择 ...'],
             ]);


             }
             else
             {
                 $showForm['order_' . $orderAttr->attr_field_name]['form']       =  $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][content]" )->label($orderAttr->attr_spec_name)->textInput(['maxlength' => 64]);
             }

             echo $form->field($orderModel, "localAttrsInsts[{$orderAttr->attr_spec_id}][attrSpecTypeID]",['labelOptions'=>['style'=>'display:none']])->hiddenInput(['value' => $orderAttr->attr_spec_type_id]);

         }
//     }

    // 查找出客户的特性
    foreach ($attrSpecs as $attrSpec)
    {
        $prodAttr = $attrSpec->attrSpecs;

        // 文件
        if ($prodAttr->attr_spec_type_id==2)
        {
            $pluginOptions=[];
            $pluginOptions['initialPreviewAsData'] = true;
            $pluginOptions['showRemove'] = true;
            $pluginOptions['showUpload'] = false;

            if ($update)
            {
                $pluginOptions['initialPreview'] = $p1[$prodAttr->attr_spec_id];
            }

            $showForm[$prodAttr->attr_field_name]['form']   =  $form->field($uploadModel, "file[{$prodAttr->attr_spec_id}][]")->label($prodAttr->attr_spec_name)->widget(FileInput::classname(), [
                                                    'options' => ['multiple' => false],
                                                    'pluginOptions' =>$pluginOptions,
                                                    ])->fileInput();
        }
        elseif ($prodAttr->attr_spec_type_id==3) // 如果type等于3 需要进行字符转义
        {
            $showForm[$prodAttr->attr_field_name]['form']   =   $form->field($model, "localAttrsInsts[{$prodAttr->attr_spec_id}][content]")->label($prodAttr->attr_spec_name)->dropDownList(Functions::getDomains('attr_spec',$prodAttr->attr_spec_id));
        }
        elseif ($prodAttr->attr_spec_type_id==4) // 如果type等于4 说明是一组值
        {
            $showForm[$prodAttr->attr_field_name]['form']               =  $form->field($model, "localAttrsInsts[{$prodAttr->attr_spec_id}][content]")->label( '最小'. $prodAttr->attr_spec_name)->textInput(['maxlength' => 64]);
            $showForm[$prodAttr->attr_field_name . '_2']['form']       =  $form->field($model, "localAttrsInsts[{$prodAttr->attr_spec_id}][content2]")->label('最大'.$prodAttr->attr_spec_name)->textInput(['maxlength' => 64]);
        }

        else
        {
            $showForm[$prodAttr->attr_field_name]['form']   =   $form->field($model, "localAttrsInsts[{$prodAttr->attr_spec_id}][content]" )->label($prodAttr->attr_spec_name)->textInput(['maxlength' => 64]);
        }

        // 隐藏的直接输出
        echo $form->field($model, "localAttrsInsts[{$prodAttr->attr_spec_id}][attrSpecTypeID]",['labelOptions'=>['style'=>'display:none']])->hiddenInput(['value' => $prodAttr->attr_spec_type_id]);

    }

//Yii::trace("==================");
//Yii::trace($showForm);

?>

<div class="col-md-12">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title"><?php echo Html::encode('客户资料'); ?></h3>
        </div>
        <div class="box-body">
<!--        --><?php //if (!$update): ?>

            <div class="col-md-2">
                <?php  echo   $showForm['phone']['form'] ; ?>
            </div>

            <div class="col-md-2">
                <?php  echo   $showForm['cust_name']['form'] ; ?>

            </div>

            <div class="col-md-2">
                <?php  echo   $showForm['industry_type']['form'] ; ?>
            </div>



            <div class="col-md-2">
                <?php  echo   $showForm['parent_cust_source_id']['form'] ; ?>
            </div>

            <div class="col-md-2">
                <?php  echo   $showForm['cust_source_id']['form'] ; ?>
            </div>

            <div class="col-md-1">
                <?php  echo   $showForm['cust_type_id']['form'] ; ?>
            </div>

            <div class="col-md-1">
                <?php  echo   $showForm['cust_level']['form'] ; ?>
            </div>

<!--        --><?php //endif; ?>
        </div>
    </div>
</div>

<div class="col-md-12">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title"><?php echo Html::encode('客户需求'); ?></h3>

        </div>
        <div class="box-body demand">
<!--        --><?php //if (!$update): ?>
            <div class="col-md-9">

                <div class="col-md-12">
                    <?php  echo   $showForm['order_region_id']['form'] ; ?>
                </div>
                <div class="col-md-2">
                    <?php  echo   $showForm['order_building_type']['form'] ; ?>
                </div>



                <div class="col-md-2">
                    <?php  echo   $showForm['order_need_area']['form'] ; ?>
                </div>
                <div class="col-md-2">
                    <?php  echo   $showForm['order_need_area_2']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_budget']['form'] ; ?>
                </div>
                <div class="col-md-2">
                    <?php  echo   $showForm['order_budget_2']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_lease_term']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php
                        echo   $showForm['order_renovation_flag']['form'] ;
                    ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_floor']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_whole_flag']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_consult_type']['form'] ; ?>
                </div>

                <div class="col-md-2">
                    <?php  echo   $showForm['order_use_phone']['form'] ; ?>
                </div>



                <div class="col-md-4">

                        <label >信息默认有效</label>

                        <select id="d" name="state" class="form-control">
                            <option value="30001" selected="selected">订单信息有效</option>
                            <option value="30003" class="text-red" >订单作废（请慎重选择！）</option>
                        </select>


                </div>

                <div class="col-md-4">

                    <?php  echo   $showForm['input_time']['form'] ; ?><!--日期-->
                </div>


                <div class="col-md-4">
                    <?php  echo   $showForm['orderStaffID']['form'] ; ?>


                </div>

            </div>
            <div class="col-md-3">
                <div class="col-md-12">
                    <?php  echo   $showForm['order_remark']['form'] ; ?>
                </div>


                    <h5 id="cl" style="display:none;">跟进记录( 请务必填写作废原因! )</h5>
                    <textarea  name="remarkd" style="display:none;" class="form-control" maxlength="256" placeholder='请务必填写作废原因'></textarea>

            </div>


            <?php  // 第二行  ?>






<!--        --><?php //endif; ?>
        </div>


    </div>
</div>





        <div class="col-md-12">
        <?php echo Html::submitButton($model->isNewRecord ? Yii::t('region', 'Create') : Yii::t('region', 'Update'), [
            'class' => $model->isNewRecord? 'btn btn-success' : 'btn btn-primary', ]); ?>
        <?php echo Html::a(Yii::t('region', 'Cancel'), Yii::$app->request->getReferrer(), ['class' => 'btn btn-default']); ?>
        </div>




<?php ActiveForm::end(); ?>


<?php

    // 如果是更新，不进行电话号码填充，但是要进行重复的判定
    if ($update)
    {
$js = <<<JS

jQuery('input#cust-localattrsinsts-3-content').on('blur',function() {

 


    $.get(
        '/prod/order/repeatorder',
        {
            tel: $(this).val(),
            order_id: $("#order-id").val()
        },
        function (data) {
        
           if (data.results.code==1||data.results.code==2)
           {
                if (data.results.code==2)
                {
                    if (data.results.order_staff_name==null)
                    {
                        $(".repeatorder-desc").text("客户有正在处理的需求，请不要重复录入，目前订单在公盘" ) ;
                    }
                    else 
                    {
                        $(".repeatorder-desc").text("客户有正在处理的需求，请不要重复录入，目前"  + data.results.order_staff_group+ "的"+ data.results.order_staff_name+"正在处理中") ;
                     
                    }
                   
                    $("#tel-repeat-warning").show();
                }
                else
                {
                    $(".repeatorder-desc").text("客户已存在，但暂时没有需求，请放心修改号码."  ) ;
                    $("#tel-repeat-warning").show();
                 
                }
           }
           else 
            {
                $("#tel-repeat-warning").hide();
             
                //$("#cust-repeat-warning").hide();
            }
         
           
        }  
    );
});

JS;
        $this->registerJs($js);
    }
    else
    {
$js = <<<JS

jQuery('input#cust-localattrsinsts-3-content').on('blur',function() {

    $.get(
        '/prod/order/repeatorder',
        {
            tel: $(this).val()
        },
        function (data) {
        
           if (data.results.code==1||data.results.code==2)
           {
                
                
                $("#cust-cust_name").val(data.results.cust_name);
                $("#cust-localattrsinsts-24-content").val(data.results.cust_localattrsinsts_24_content);
                $("#cust-parentcustsourceid").val(data.results.cust_parentcustsourceid);
                $("#cust-cust_source_id").val(data.results.cust_source_id);
                $("#cust-cust_type_id").val(data.results.cust_type_id);
                $("#cust-localattrsinsts-43-content").val(data.results.cust_localattrsinsts_43_content);
                
                if (data.results.code==2)
                {
                    
                    if (data.results.order_staff_name==null)
                    {
                        $(".repeatorder-desc").text("客户有正在处理的需求，请不要重复录入，目前订单在公盘" ) ;
                    }
                    else 
                     {
                        $(".repeatorder-desc").text("客户有正在处理的需求，请不要重复录入，目前"  + data.results.order_staff_group+ "的"+ data.results.order_staff_name+"正在处理中") ;
                     }
                   
                    $("#tel-repeat-warning").show();
                   // $("#cust-repeat-warning").hide();
                
                    $(":submit").text('只更新跟进记录');
                   
                    $("#order-region_id").val(data.results.order_region_id);
                    $("#order-localattrsinsts-34-content").val(data.results.order_localattrsinsts_34_content);
                    $("#order-localattrsinsts-11-content").val(data.results.order_localattrsinsts_11_content);
                    $("#order-localattrsinsts-11-content2").val(data.results.order_localattrsinsts_11_content2);
                    $("#order-localattrsinsts-23-content").val(data.results.order_localattrsinsts_23_content);
                    $("#order-localattrsinsts-23-content2").val(data.results.order_localattrsinsts_23_content2);
                    $("#order-localattrsinsts-42-content").val(data.results.order_localattrsinsts_42_content);
                    $("#order-localattrsinsts-25-content").val(data.results.order_localattrsinsts_25_content);
                    
                    $("#order-localattrsinsts-14-content").val(data.results.order_localattrsinsts_14_content);
                    $("#order-localattrsinsts-31-content").val(data.results.order_localattrsinsts_31_content);
                    $("#order-localattrsinsts-44-content").val(data.results.order_localattrsinsts_44_content);
                    $("#order-input_time").val(data.results.order_input_time);
                    
                    
                    
                    $("#order-staff_id").val(data.results.order_staff_id).trigger("change");
                    
                    $("#select2-order-staff_id-container").html('<span class="select2-selection__clear">×</span>'+data.results.order_staff_name);
                    $("#order-remark").val(data.results.order_remark);
                }
                else
                {
                    $(".repeatorder-desc").text("客户已存在，但暂时没有需求，请放心录入."  ) ;
                     $("#tel-repeat-warning").show();
                      $(":submit").text('创建');
                    //$("#cust-repeat-warning").show();
                }
               
                
                $(".form-group #cust-cust_source_id").show();
                
                $.get(
                '/prod/cust/custsource',          
                {
                    parent_cust_source_id : data.results.cust_parentcustsourceid,
                    cust_source_id : data.results.cust_source_id
                },function(data){
                    $("select#cust-cust_source_id").html(data);
                    });
           }
           else 
            {
                $("#tel-repeat-warning").hide();
                $(":submit").text('创建');
               
            }
         
           
        }  
    );
});
JS;
        $this->registerJs($js);

    }






// 1 作废

// 2写入外部引用的js脚本
// 响应电话号码的字段
//
$js = <<<JS


function checkPhone(phone){ 
    
    if(!(/^1(3|4|5|7|8)\d{9}$/.test(phone))){ 
        //alert("手机号码有误，请重填");  
        return false; 
    } 
    return true;
}

function checkTel(tel){

if(!/^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{7,14}$/.test(tel)){
    //alert('固定电话有误，请重填');
    return false;
    }
    
    return true;
}

var checkNumber = function( ){
   
     var c=$(this);  
            if(/[^\d]/.test(c.val())){//替换非数字字符  
              var temp_amount=c.val().replace(/[^\d]/g,'');  
              $(this).val(temp_amount);  
            }  
}

var checkFloat = function( ){
   
     var c=$(this);  
            if(/[^\-?\d.]/g.test(c.val())){//替换非数字字符  
              var temp_amount=c.val().replace(/[^\d]/g,'');  
              $(this).val(temp_amount);  
            }  
}

function checkEmpty( formInput, msg)
{
    if (formInput.val()== "")
    {
        formInput.parent().addClass('has-error');
        formInput.siblings(".help-block").text(msg);
        return false;
    }
    formInput.parent().removeClass("has-error");
    formInput.siblings(".help-block").text('');
    formInput.parent().addClass('has-success');
    return true;

}

function size( formInput, formInput2,msg)
{
    if (parseInt(formInput.val())< parseInt(formInput2.val()))
    {
        formInput.parent().addClass('has-error');
        formInput.siblings(".help-block").text(msg);
        return false;
    }
    formInput.parent().removeClass("has-error");
    formInput.siblings(".help-block").text('');
    formInput.parent().addClass('has-success');
    return true;

}
$('input#cust-localattrsinsts-3-content').keyup(checkNumber);
$('input#order-localattrsinsts-11-content').keyup(checkFloat);
$('input#order-localattrsinsts-11-content2').keyup(checkFloat);
$('input#order-localattrsinsts-23-content').keyup(checkFloat);
$('input#order-localattrsinsts-23-content2').keyup(checkFloat);
//$('input#order-localattrsinsts-14-content').keyup(checkNumber);//楼层的数字替换


$('form#w0').on('beforeSubmit', function(e) {

    var relustEmpty = true;
    var phone     = $(this).find('#cust-localattrsinsts-3-content');
    var minArea   = $(this).find('#order-localattrsinsts-11-content');
    var maxArea   = $(this).find('#order-localattrsinsts-11-content2');
    var minPayFee = $(this).find('#order-localattrsinsts-23-content');
    var maxPayFee = $(this).find('#order-localattrsinsts-23-content2');
    if (!checkEmpty(phone,'号码不能为空！') ){ relustEmpty = false;}
    if (!checkEmpty(minArea,'最小需求面积不能为空！')){relustEmpty = false;}
    if (!checkEmpty(maxArea,'最大需求面积不能为空！！') ){relustEmpty = false;}
    if (!checkEmpty(minPayFee,'最小租金不能为空！') ){relustEmpty = false;}
    if (!checkEmpty(maxPayFee,'最大租金不能为空！')){relustEmpty = false;}
    
    
    
   return relustEmpty;
});

jQuery('#d').on('click',function() {

    if($(this).val()==30003){
        $('textarea').show();
        $('#cl').show();
    }else{
        $('textarea').eq(1).hide();
        $('#cl').hide();
    }

});

jQuery('input#order-localattrsinsts-11-content').on('blur',function() {

    checkEmpty($(this),'最小需求面积不能为空！');
});

jQuery('input#order-localattrsinsts-11-content2').on('blur',function() {

    size( $(this),$("#order-localattrsinsts-11-content"),'最大面积不能小于最小面积');

});

jQuery('input#order-localattrsinsts-23-content').on('blur',function() {

    checkEmpty($(this),'最小租金不能为空');
});

jQuery('input#order-localattrsinsts-23-content2').on('blur',function() {

    size($(this),$("#order-localattrsinsts-23-content"),'最大租金不能小于最小租金');
});

jQuery('input#cust-localattrsinsts-3-content').on('blur',function() {

    // 如果没填值 则直接返回错误
    if ($(this).val()== "")
    {
        $(this).parent().addClass('has-error');
        $(this).siblings(".help-block").text('号码不能为空！');
        return false;
    }
    else 
    {
        if ( !checkPhone($(this).val()))
         {
             if ( !checkTel($(this).val()))
             {
                $(this).parent().addClass('has-error');
                $(this).siblings(".help-block").text('请填写正确的号码！');
                 return false;
             }
         }
         $(this).parent().removeClass("has-error");
         $(this).siblings(".help-block").text('');
    }
});

JS;
$this->registerJs($js);



$js = <<<JS
jQuery('.btn-warning').on('click',function() {



//获取按ID 传回内容
});
JS;
$this->registerJs($js);

////局部内容切换
//$this->widget('zii.widgets.jui.CJuiTabs', array(
//    'tabs'=>array(
//        '分类1'=>'分类1',
//        '分类2'=>array('content'=>'分类2', 'id'=>'tab2'),
//        //'分类3'=>$this->render('_form',null,true),//渲染一个页面
//        // panel 3 contains the content rendered by a partial view
//        //'AjaxTab'=>array('ajax'=>$ajaxUrl),
//    ),
//    // additional javascript options for the tabs plugin
//    'options'=>array(
//        'collapsible'=>true,
//    ),
//));
//
//
//
//Modal::begin([
//    'id' => 'cancel-order-modal',
//    'class' => 'modal modal-primary',
//    'header' => '<h4 class="modal-title">订单作废（请慎重选择！）</h4>',
//    'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
//    'options' => [
//        'tabindex' => false
//    ],
//]);
//Modal::end();
//$js = <<<JS
//jQuery('#c').on('blur',function() {
//alert($('#c').val())
//
//
//
//});
//JS;
//$this->registerJs($js);



?>